//
//  ANWebService+User.h
//  Ants
//
//  Created by ZHM on 16/4/24.
//  Copyright © 2016年 ZHM. All rights reserved.
//

#import "ANWebService.h"

@interface ANWebService (User)



/**
 *  判断用户是否登录，匿名登录判断为未登录
 */
- (BOOL)isLoggedIn;

/**
 *  返回当前用户，未登录状态(使用 isLoggedIn 方法判断)返回 nil
 */
- (ANBmobUser *)currentUser;

/**
 * 账号 注册
 */
- (void)registeredWithName:(NSString *)name passWord:(NSString *)passWord completion:(void(^)(ANBmobUser *user,BOOL succeeded,NSError *error))completion;
/**
 * 账号 登录
 */
- (void)loginWithAccount:(NSString *)account passWord:(NSString *)passWord completion:(void(^)(BmobUser *user, BOOL succeeded, NSError *error))completion;
/**
 * 注销 删除本地账号
 */
- (void)logout;
/**
 * 更新用户昵称
 */
- (void)updateNickName:(NSString *)nickName completion:(void(^)(BOOL succeeded, NSError *error))completion;
/**
 * 更新手机号
 */
- (void)updatePhoneNumber:(NSString *)phoneNumber completion:(void(^)(BOOL succeeded, NSError *error))completion;
/**
 * 更新头像
 */
- (void)updatePhoto:(UIImage *)image completion:(void(^)(NSString *filePath, BOOL succeeded, NSError *error))completion;
/**
 * web获取用户 并本地保存
 */
- (void)fetchUserWithBmobCompletion:(void(^)(ANBmobUser *user, NSError *error))completion;
/**
 *  同步用户的头像
 */
- (void)syncUserIconWithBmobWithCompletion:(void(^)(BOOL succeeded, NSError *error))completion;
/**
 * 保存本地用户信息
 */
- (void)fetchUserBasicInfoWithCompletion:(void(^)(ANBDUser *user, NSError *error))completion;
@end
